<template>
  <el-config-provider :button="config" :size="assemblySize" :locale="i18nLocale">
    <router-view></router-view>
  </el-config-provider>
</template>
<script setup lang="ts">
import { reactive, computed } from 'vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import { useStore } from '@/store/index.ts'

const { global } = useStore()
// 配置Element-plus按钮文字中间是否有空格
const config = reactive({
  autoInsertSpace: true,
})

// 配置Element-plus全局组件大小 (small/default(medium)/large)
const assemblySize = computed((): string => global.assemblySize)
// 配置Element-plus全局国际化
const i18nLocale = computed(() => {
  if (global.language && global.language == 'zh') {
    return zhCn
  } else {
    return en
  }
})
</script>
<style lang="less"></style>
